

# 面包屑导航的作用:  是告诉用户，他们目前在网站中的位置以及如何返回。
from rest_framework import serializers

from goods.models import GoodsChannel, GoodsCategory


class CategorySerializer(serializers.ModelSerializer):
    ''' 类别序列化器'''

    class Meta:
        model = GoodsCategory
        fields = ('id', 'name')


class ChannelSerializer(serializers.ModelSerializer):
    """ 频道序列化器 """
    category = CategorySerializer()

    class Meta:
        model = GoodsChannel
        fields = ('category', 'url')